/**
 * Created by Administrator on 2016/10/16.
 */
angular.module('user.service', []).service('$userService', ['$http', function ($http) {
    /**
     * 用户注册
     */
    this.registerUser = function (params, success, fail) {
        $http({
            method: 'POST',
            url: '/users/',
            data: params
        }).then(success, fail);
    };
    /**
     * 用户登录
     */
    this.login = function (params, success, fail) {
        $http({
            method: 'POST',
            url: '/users/login/',
            data: params
        }).then(success, fail);
    }
    /*退出*/
    this.logout= function() {
        $http.post('/users/logout/');
    }
}]);